package Chapter07.Homework.H20211021;

public class System1 {
    Member member[]=new Member[100];

    int pos=0;//会员号个数
    boolean b=false;
    public boolean add(Member ad) {
        if (pos >= member.length) {
            System.out.println("会员号已满");
            return false;
        }
        for (int i = 0; i < pos; i++) {
            if (member[i].id.equals(ad.id)) {
                System.out.println("会员号重复");
                return false;
            }
        }
        member[pos++] = ad;
        return false;
    }
    //查看会员信息
    public void show(){
        System.out.println("姓名\t会员号\t手机号\t积分");
        for (int i=0;i<pos;i++){
            System.out.println(i+1+1+"\t");
            member[i].show();
        }
    }
    //会员号涨分
    public boolean up(String id,int fen){
        for (int i=0;i<member.length;i++){
            if(member[i]!=null){
                if(member[i].id.equals(id)){
                    member[i].score=member[i].score+fen;
                    return  true;
                }else {
                    System.out.println("账号不存在");
                }
            }
        }
        return false;
    }
}

